<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小行星会员上线啦</title>
    <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
          name="viewport">
    <meta content="ie=edge" http-equiv="X-UA-Compatible">
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
            font-size: 0;
        }

        .message-box {
            width: 100%;
            position: fixed;
            bottom: 36px;
            text-align: center;
            display: none;
            z-index: 1000;
        }

        .message {
            display: inline-block;
            font-size: 16px;
            padding: 7px 13px;
            border-radius: 9px;
            background-color: #6F6F6F;
            color: white;
        }

        img {
            width: 100%;
        }
    </style>
</head>
<body style="background-color: rgb(40,19,69);width: 100%">
<div><img src="{$oss}active/vip/info_01.png" alt=""></div>
<div><img src="{$oss}active/vip/info_02.png" alt=""></div>
<div><img src="{$oss}active/vip/info_03.png" alt=""></div>
<div><img src="{$oss}active/vip/info_04.png" alt=""></div>
<div><img src="{$oss}active/vip/info_05.png" alt=""></div>
<div><img src="{$oss}active/vip/info_06.png" alt=""></div>
<div class="open-vip" onclick="activeGive()"><img src="{$oss}active/vip/info_07.png" alt=""></div>
<div class="message-box">
    <div class="message"></div>
</div>
<a class="go-pay" href="{$m}/pay_order?type=8&need_auth=2" target="_blank" style="display: none"></a>
</body>
<script type="text/javascript" src="{$oss}active/seven/js/jquery-v2.1.1.min.js"></script>
<script type="text/javascript">
    var a = 1;

    function activeGive() {
        if (a == 2) {
            return false;
        }
        a = 2;
        $.ajax({
            url: '/api/v12/coupon_active_give',
            type: 'GET',
            dataType: 'json',
            headers: {$headers},
            success: function (res) {
                if (res.code == 200) {
                    setTimeout(function () {
                        $('.go-pay')[0].click();
                        a = 1;
                    }, 1500);
                } else {
                    if (res.msg == '无可领取卷') {
                        $('.go-pay')[0].click();
                        a = 1;
                        return false;
                    } else if (res.code == 403) {
                        $('.go-pay')[0].click();
                        a = 1;
                        return;
                    }
                }
                message(res.msg);
            }
        })
    }

    function message(text) {
        $('.message').text(text);
        $('.message-box').show();
        setTimeout(function () {
            $('.message-box').hide();
            a = 1;
        }, 2500);
    }
</script>
{include file="../apps/web/view/public/sensors.html" /}
</html>
